{smcl}
{* 11aug2013}{...}
{hline}
help for {hi:ivreg2h}
{hline}

{title:Instrumental variables estimation using heteroskedasticity-based instruments}

{title:Description}

{p}{cmd:ivreg2h} estimates an instrumental variables regression model providing the
option to generate instruments using Lewbel's (2012) method. This technique allows
the identification of structural parameters in regression models with endogenous or 
mismeasured regressors in the absence of traditional identifying information such as 
external instruments or repeated measurements. Identification is achieved in this context 
by having regressors that are uncorrelated with the product of heteroskedastic errors, 
which is a feature of many models where error correlations are due to an unobserved common factor.
The greater the degree of scale heteroskedasticity in the error process, the higher will 
be the correlation of the generated instruments with the included endogenous variables 
which are the regressands in the auxiliary ('first stage') regressions.

{p}Using this form of Lewbel's method, instruments may be constructed as simple functions of the model's data.
 This approach may be ({cmd:a}) applied when no external instruments are available, or, alternatively, 
({cmd:b})  used to supplement external instruments to improve the efficiency of the IV estimator.
Supplementing external instruments can also allow Sargan-Hansen tests of the orthogonality conditions
or overidentifying restrictions to be performed, which would not be available in the case 
of exact identification by external instruments.

{p}This implementation has been built using the existing {cmd:xtivreg2} (Schaffer) 
and {cmd:ivreg2} (Baum, Schaffer, Stillman) routines. At present it does not provide any
explicit support for panel data (but see the second example below). 
As {cmd:ivreg2h} is a variant of {cmd:ivreg2}, essentially
all of the features and options of that program are available in {cmd:ivreg2h}. For that
reason, you should consult {help ivreg2:help ivreg2} for details of the available options.

{p}{cmd:ivreg2h} does provide two additional options: {cmd:gen} and {cmd:gen(}{it:string}{cmd:[,replace])}.
If the {cmd:gen} option is given, the generated instruments are saved, with names built from
the original variable names suffixed with {cmd:_g}. 
If greater control over the naming
of the generated instruments is desired, use the {cmd:gen(}{it:string}{cmd:[,replace]} option. 
The {it:string} argument allows the specification of a stub, or prefix, for the generated variable names,
which will also be suffixed with {cmd:_g}. 
You may remove earlier instruments with those same names with the {cmd:replace} suboption.

{p}{cmd:ivreg2h} can be invoked to estimate a traditionally identified single equation, 
or a single equation that--before augmentation with the generated instruments--fails the 
order condition for identification:
either ({cmd:a}) by having no excluded instruments, 
or ({cmd:b}) by having fewer excluded instruments than needed for 
traditional identification. 

{p}In the former case ({cmd:a}), of adequate external instruments augmented by 
generated instruments, the program provides three sets of estimates: the traditional IV 
estimates, estimates using only generated instruments, and estimates using both 
generated and excluded instruments. 
{cmd:ivreg2h} automatically produces a Hayashi "C" test of the excluded instruments' validity 
(equivalent to use of the {cmd:orthog} option in {cmd:ivreg2}). 
The results of the third estimation (that including both generated and excluded instruments) are saved in the ereturn list. All three sets of estimates are saved, named {it:StdIV}, {it:GenInst} and {it:GenExtInst}, respectively.

{p}In the latter case ({cmd:b}), of an underidentified equation, either one or two sets
of estimates will be produced and displayed. 
If there are no excluded instruments, only the estimates using 
generated instruments are displayed. 
If there are excluded instruments but too few to produce identification by 
the order condition, the estimates using only generated instruments and those produced by 
generated and excluded instruments will be displayed.
Unlike {cmd:ivreg2} or {cmd:ivregress}, {cmd:ivreg2h} allows the syntax 
{it:ivreg2h depvar exogvar (endogvar=)}, as after augmentation with the generated regressors, 
the order condition for identification will be satisfied.
The resulting estimates are saved in the 
ereturn list and as a set of estimates named {it:GenInst} and, optionally, {it:GenExtInst}.

{title:Saved Results}

{p}Note that in the {cmd:estimates table} output, the displayed results {it:j}, {it:jdf} and
{it:jp} refer to the Hansen J statistic, its degrees of freedom, and its p-value. 
If i.i.d. errors are assumed, and a Sargan test is displayed in the standard output,
 the Sargan statistic, degrees of freedom and p-value are displayed in {it:j}, {it:jdf} and 
 {it:jpval}, as the Hansen and Sargan statistics coincide in that case.

{p}The results of the most recent estimation are saved in the ereturn list. Please see
{cmd:help ivreg2} for details. 
 
{title:Examples}

{p 8 12}Example from Lewbel (2012). Note that centering of regressors is only used to match the results. 

{p 8 12}{inp:.} {stata "ssc install center  ":ssc install center // (if needed)}

{p 8 12}{inp:.} {stata "ssc install bcuse  ":ssc install bcuse // (if needed)}

{p 8 12}{inp:.} {stata "bcuse engeldat  ":bcuse engeldat}

{p 8 12}{stata "center age-twocars, prefix(z_) " : . center age-twocars, prefix(z_)} 

{p 8 12}{stata "ivreg2h foodshare z_* (lrtotexp=), small robust " : . ivreg2h foodshare z_* (lrtotexp=), small robust} 

{p 8 12}{stata "ivreg2h foodshare z_* (lrtotexp = lrinc), small robust " : . ivreg2h foodshare z_* (lrtotexp = lrinc), small robust} 

{p 8 12}{stata "ivreg2h foodshare z_* (lrtotexp = lrinc), small robust gmm2s " : . ivreg2h foodshare z_* (lrtotexp = lrinc), small robust gmm2s} 

{p 8 12}Example using panel data and HAC standard errors. Centering used to remove firm fixed effects. 

{p 8 12}{inp:.} {stata "webuse grunfeld ": webuse grunfeld}

{p 8 12}{inp:.} {stata "by company: center invest kstock mvalue " : by company: center invest kstock mvalue} 

{p 8 12}{inp:.} {stata "ivreg2h c_invest L(1/2).c_kstock (c_mvalue=) ": ivreg2h c_invest L(1/2).c_kstock (c_mvalue=) }

{p 8 12}{inp:.} {stata "ivreg2h c_invest L(1/2).c_kstock (c_mvalue=L(1/4).c_mvalue), robust gmm2s bw(3) ": ivreg2h c_invest L(1/2).c_kstock (c_mvalue=L(1/4).c_mvalue), robust gmm2s bw(3)}

{title:Acknowledgements}

{p 0 4}We thank participants in the 2012 UK Stata Users Group, 2013 Mexican Stata Users Group
 and 2013 German Stata Users Group 
meetings for their constructive comments.

{title:References}

{p 0 4} Baum CF,  Lewbel A, Schaffer ME, Talavera O, 2012. Instrumental variables estimation using heteroskedasticity-based instruments.
 {browse "http://repec.org/usug2012/UK12_baum.pdf":http://repec.org/usug2012/UK12_baum.pdf}.

{p 0 4} Lewbel, A, 2012.  Using Heteroscedasticity to Identify and Estimate Mismeasured and Endogenous Regressor Models.
Journal of Business and Economic Statistics, 30:1, 67-80. {browse "http://fmwww.bc.edu/EC-P/wp587.pdf":http://fmwww.bc.edu/EC-P/wp587.pdf}.



{title:Citation}

{p}{cmd:ivreg2h} is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such: {p_end}

{phang}Baum, CF, Schaffer, ME, 2012.
ivreg2h: Stata module to perform instrumental variables estimation using heteroskedasticity-based instruments.
{browse "http://ideas.repec.org/c/boc/bocode/s457555.html":http://ideas.repec.org/c/boc/bocode/s457555.html}{p_end}

{title:Authors}

{p 0 4}Christopher F Baum, Boston College, USA{p_end}
{p 0 4}baum@bc.edu{p_end}
{p 0 4}Mark E Schaffer, Heriot-Watt University, UK{p_end}
{p 0 4}M.E.Schaffer@hw.ac.uk{p_end}


